<%= render 'base' %>

<div class="subnav">
  <nav class="subnav-links">
    <a href="<%= admin_issues_path %>" class="subnav-item"><%= t("admin.All") %></a>
  </nav>
  <div class="subnav-search float-left">
    <form action="" method="GET">
      <input type="search" name="q" class="form-control subnav-search-input" value="<%= params[:q] %>">
      <%= icon_tag "search", class: "subnav-search-icon" %>
    </form>
  </div>
</div>

<div class="admin-admin_issues">
  <table class="table table-striped">
    <tr class="head">
      <td>Id</td>
      <td><%= t("activerecord.attributes.issue.title") %></td>
      <td><%= t("activerecord.attributes.issue.user") %></td>
      <td><%= t("activerecord.attributes.issue.status") %></td>

      <td><%= t("created at") %></td>
      <td class="opts"></td>
    </tr>
    <% @issues.each do |item| %>
    <tr class="<%= cycle("","even") %>">
      <td><%= link_to item.id, admin_issue_path(item.id) %></td>

      <td>
        <div><%= link_to item.title, item.to_path, target: "_blank" %></div>
        <div class="mt-1 text-gray">#<%= item.iid %> <%= repository_path_tag(item.repository) %>
      </td>

      <td><%= user_avatar_tag(item.user, style: :tiny) %></td>

      <td style="color: <%= item.status_color %>"><%= item.status_name %></td>

      <td><%= l(item.created_at) %></td>
      <td class="opts">
        <%= link_to icon_tag("trash"), admin_issue_path(item.id), method: :delete, 'data-confirm' => t("admin.Are you sure delete this item?") %>
      </td>
    </tr>
    <% end %>
  </table>
  <%= paginate @issues %>
</div>
